package service;

import java.util.List;
import com.agentfactory.logic.agent.Perceptor;
import com.agentfactory.logic.lang.FOS;

public class RobotAgentPerceptor extends Perceptor {
	
	@Override
    public void perceive() {
    	RobotAgentService RoboService = (RobotAgentService)  this.getService(ServiceConstants.SERVICE_NAME);
    	
        if (RoboService == null) {
            adoptBelief("BELIEF(unavailable(RoboService))");
            return;
        }else{
        	List<FOS> percepts = RoboService.getPercepts(agent.getName());
        	if(percepts.contains(new FOS("robot(off)"))){
        		adoptBelief("BELIEF(robot(off))");
        	}else{
		        for (FOS fos: percepts) {
		            adoptBelief("BELIEF(" + fos.toString() + ")");
		        }
		        percepts.clear();
        	}
        }
    }
}
